clear
set more off

cd "D:\data_replication"

import delimited estimation\5_supply_side\k_to_i_k.csv
save estimation\4_demand_estimation\4_cobb_douglas_weights\k_to_i_k.dta, replace


use estimation\4_demand_estimation\4_cobb_douglas_weights\weights_k_gini.dta, clear
merge m:1 k using estimation\4_demand_estimation\4_cobb_douglas_weights\k_to_i_k.dta
keep i_k year quarter declarant s_1_k-s_100_k
order i_k year quarter declarant s_1_k-s_100_k
sort i_k year quarter declarant s_1_k-s_100_k
forval i = 1/100 {
rename s_`i'_k s_`i'_i_k
}
save estimation\4_demand_estimation\4_cobb_douglas_weights\weights_i_k_gini.dta, replace
export delimited estimation\4_demand_estimation\4_cobb_douglas_weights\weights_i_k_gini.csv, replace

rm estimation\4_demand_estimation\4_cobb_douglas_weights\k_to_i_k.dta

